package com.wuxinwudai.android.app;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import com.wuxinwudai.android.R;
import com.wuxinwudai.android.view.ImageViewPagerAdapter;

/**
 * BaseGuideActivity 类为引导 Activity 类基类
 * @author 吾心无待 于2016年02月27日
 */
public abstract class BaseGuideActivity extends BaseActivity {

    /**
     * 获取引导图片
     * @return 引导图片数组
     */
    public abstract int[] getGuideImages();
    /**
     * 获取将要跳转的 Activity 的类型,可以是启动页或首页等
     * @return 启动页火首页，用于跳转
     */
    public abstract Class getGoActivity();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_guide_base);
        ViewPager vp = (ViewPager)findViewById(R.id.viewPager);
        vp.setAdapter(new ImageViewPagerAdapter(BaseGuideActivity.this,getGuideImages()));
        TextView tv = (TextView)findViewById(R.id.tv_start);
        tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(BaseGuideActivity.this, getGoActivity()));
                finish();
            }
        });
    }
}
